import 'package:flutter/foundation.dart';

mixin SafeChangeNotifier on ChangeNotifier {
  bool mounted = true;

  @override
  void notifyListeners() {
    if (mounted) {
      super.notifyListeners();
    }
  }

  @override
  void dispose() {
    mounted = false;
    super.dispose();
  }
}
